﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ComputerShopE3.Models.SAN_PHAM>" %>
<%@ Import Namespace="MyHelper" %>
<%@ Import Namespace="ComputerShopE3.Controllers" %>


<h2><%= Html.Encode(Model.TenSanPham)%></h2>
<div class = "product-image">
    <% foreach (var ha in Model.HINH_ANH)
               { %>
            <% = Html.ImageActionLink("../../content/data_images/" + ha.Url, "details", Model.LOAI_SAN_PHAM.TenLoaiSanPham, new { id = Model.id }, null, null)%>
     <% } %>
</div>
<div class = "product-price">
    Giá:&nbsp; <%= Html.Encode(Model.Gia)%> VND
</div>
<% var Diem = (Model.Diem > 5) ? 5 : Model.Diem; %>
<% for (int i = 0; i < Diem; i++)
   { %>
<img src="../../Content/images/choice.png" />
<% }
   Diem = 5 - Diem;
   for (int i = 0; i < Diem; i++)
   { %>
<img src="../../Content/images/nochoice.png" />
<% } %>

    <table>
    <tbody>     
        <td>Nhà Sản xuất</td>
        <td>
            <% if (Model.NHA_SAN_XUAT != null)
               { %>
            <%= Html.Encode(Model.NHA_SAN_XUAT.TenNSX)%>
            <% } %>
        </td>
    </tr>
    <tr>
        <td>Nhà Phân Phối</td>
        <td>
            <% if (Model.NHA_PHAN_PHOI != null)
               { %>
            <%= Html.Encode(Model.NHA_PHAN_PHOI.TenNhaPhanPhoi)%>
            <% } %>
        </td>
    </tr>
    <tr>
        <td>Bán từ </td>
        <td><%= Html.Encode(String.Format("{0:g}", Model.NgayThemSP))%></td>
    </tr>
    <tr>
        <td>Bảo Hành</td>
        <td><%= Html.Encode(Model.BaoHanh)%></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>

</tbody>        
</table>

<p>
<% SiteRoles role = SpiderE3AuthorizeAttribute.GetCurrentRole(Context);
    if (role == SiteRoles.Admin || role == SiteRoles.Employee)
    { %>
        <%=Html.ActionLink("Chỉnh sửa", "Edit", new { id=Model.id }) %> |
<%  } %>
<%=Html.ActionLink("Quay về danh mục", "Index") %>
</p>


